'use strict';

stareal
    .controller("MyFansListController", function ($scope, $stateParams, $api, $state,$lazyLoader,$rootScope,localStorageService,$alert) {
        $scope.comments = new $lazyLoader("app/view/fanslist", {},true)
        //用户关注
        //用户关注
        $scope.viewAttention=function(id,index) {
            console.log(index)
            $api.post("app/follow/create",{author_id:id},true)
                .then(function (ret) {
                    //console.log("333");
                    //  console.log(ret);
                    if(ret.follow==1){
                        //$scope.viewfavorText="已关注";
                        $scope.comments.items[index].follow=1;
                        $alert.show("关注成功!");
                       // location.reload();
                    }else{
                        //$scope.viewfavorText="+关注";
                        $scope.comments.items[index].follow=0;
                        $alert.show("取消关注!");
                        //location.reload();
                    }
                },function (err){
                    console.log(err);
                    $alert.show(err);
                })
        }
    });